<template>
  <input v-if="number < 3" type="text" v-focus v-lifeCycle v-model="number" />
  <button @click="number++">按钮</button>
  <div v-formateTime="'YYYY/MM/DD'">{{ contentTime }}</div>
  <div v-formateTime>{{ contentTime }}</div>
  <div ref="text">{{ aaa }}</div>
</template>
<!-- <script>
局部注册指令
export default {
  directives: {
    focus: {
      mounted(el) {
        el.focus();
      },
    },
  },
  setup(){

  }
};
</script> -->
<script setup>
import { ref, watchEffect } from "vue";
const number = ref(0);
const contentTime = ref(1643457329175);
const text = ref(null);
watchEffect(() => {
  console.log(typeof text.value.innerHTML);//innerHTML,innerText,textContent他们的值都是string类型
},{flush: "post"});

const aaa = ref({name:'123'});
</script>

<style scoped></style>
